package com.migu.rbac.vo;

public interface GlobalConst {

    /**
     * 状态码
     * 
     * @author zhangwei
     *
     */
    public static final class Code {
        // 微服务的code
        public final static Integer SUCCESS_200 = 200; // 请求成功
        public final static Integer NO_LOGIN_409 = 409; // 用户未登录
        public final static Integer ERROR_410 = 410; // 请求参数错误或者参数不合法
        public final static Integer ERROR_400 = 400; // 请求失败
        public final static Integer REMOTE_ERROR_411 = 411; // 远程请求异常
        public final static Integer FAIL_500 = 500; // 服务器系统异常
        public final static Integer REMOTE_FAIL_600 = 600; // 乐高鉴权失败
        public final static Integer AUTH_FAIL_700 = 700; // 菜单鉴权失败
    }

    /**
     * code枚举
     */
    public enum ResponseCode {
        SERVICE_SUCCESS(Code.SUCCESS_200, "SUCCESS"),
        SERVICE_PARAM_ERROR(Code.ERROR_410,"参数校验失败"),
        REMOTE_ERROR(Code.REMOTE_ERROR_411, "远程请求失败"),
        DB_ERROR(2000, "数据库错误"),
        USER_NULL(900, "用户信息为空"),
        USER_EXIST(901, "用户名已存在"),
        USER_PHONE_NULL(902,"手机号为空"),
        USER_ID_NULL(903, "用户ID为空"),
        USER_ADD_SUCCESS(200,"用户新增成功"),
        USER_UPDATE_SUCCESS(200, "用户信息更新成功"),

        SERVICE_USERINFO_ERROR(1025, "查询用户信息失败"),
        SERVICE_ROLE_ADD_FAIL(1026,"新增角色信息失败"),
        SERVICE_ROLE_DELETE_FAIL(1027, "删除角色信息失败"),
        SERVICE_ROLE_UPDATE_FAIL(1028, "更新角色信息失败"), 
        SERVICE_ROLE_SEARCH_FAIL(1029,"查询角色信息失败"),
        SERVICE_USER_ROLE_BIND_ERROR(1030,"绑定用户角色信息失败"),
        SERVICE_USER_ROLE_SEARCH_ERROR(1031, "查询用户角色绑定信息失败"),
        SERVICE_PERMISSION_ADD_FAIL(1032,"新增权限信息失败"), 
        SERVICE_PERMISSION_DELETE_FAIL(1033,"删除权限信息失败"),
        SERVICE_PERMISSION_UPDATE_FAIL(1034,"更新权限信息失败"),
        SERVICE_PERMISSION_SEARCH_FAIL(1035,"查询权限信息失败"),
        SERVICE_ROLE_PERMISSION_BIND_ERROR(1036,"绑定角色权限信息失败"),
        SERVICE_ROLE_PERMISSION_SEARCH_ERROR(1037,"查询角色权限绑定信息失败"), 
        SERVICE_EXISTING_USER_ROLE_BIND_ERROR(1038,"该角色存在未解绑的用户，不能删除"),
        SERVICE_EXISTING_ROLE_PERMISSION_BIND_ERROR(1039,"该角色存在未解绑的权限，不能删除"), 
        SERVICE_EXISTING_PERMISSION_ROLE_BIND_ERROR(1040,"该权限存在未解绑的角色，不能删除");

        private int code;
        private String msg;

        private ResponseCode(int code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public String getMsg() {
            return this.msg;
        }

        public int getCode() {
            return this.code;
        }
    }

    /**
       * 返回Header统一code标识
       */
    public static final String SRV_CODE = "srv_code";

    /**
     * mongo的时间差
     * <mongo的时间比东八区晚了八个小时>
     */
    public static final long MONGO_ADD_TIME = 8 * 60 * 60 * 1000;

    /**
     * 时间常量
     * 
     * @author Krame
     *
     */
    public static final class TimeConst {
        public final static int MINUTE = 60; // 秒 1分钟
        public final static int MINUTE5 = 300; // 秒 5分钟
        public final static int MILLISECONDS = 0; // 毫秒 1分钟 60000
        public final static int ZERO = 0; // 0秒，设置不偏移
        public final static int SECOND = 1; // 1秒
        public final static int SECOND2 = 2; // 2秒
        public final static int SECOND10 = 10; // 10秒
        public final static int SECOND5 = 5; // 5秒
        public final static int HOURS = 3600; // 一小时
        public final static int HOURS2 = 7200; // 两小时
        public final static int DAYS = 86400; // 一天
        public final static int SECOND30 = 30; // 30秒

        public final static int HALFHOURS = 1800; // 半小时

        public final static int DAYS7 = 604800; // 7天
        public final static int DAYS15 = 1209600; // 15天
        public final static int MONTH = 2419200; // 30天，一月
        public final static int TWOMONTH = 2419200 * 2; // 60天，2月
    }

    public static interface ExpireType {
        public final static int NO_EXPIRE = 0; // 无有效期
        public final static int MINUTE = 1; // 分钟
        public final static int DAY = 2; // 天
        public final static int MONTH = 3; // 月
        public final static int YEAR = 4; // 年
        public final static int END_OF_DAY = 21; // 日终
        public final static int END_OF_MONTH = 22; // 月末
        public final static int END_OF_YEAR = 23; // 年末
        public final static int DIRECT = 100; // 指定日期
    }

    /**
     * redis key 前缀
     * @author xjm
     */
    public static final class KeyConst {
        // public final static String TTL = "WECHAT_TTL";
        // public final static String PM_SMS_CODE = "WECHAT_PM_SMS_CODE";
        // public final static String PM_SMS_CODE_TTL =
        // "WECHAT_PM_SMS_CODE_TTL";
        public final static String SECURITY_USER = "WECHAT_SECURITY_USER";

    }

    /**
     * mongodb表名
     * @author yuanyukun
     *
     */
    public static class MongodbName {
        public static final String PERMISSION = "PERMISSION";
        public static final String ROLE = "ROLE";
        public static final String ROLE_PERMISSION = "ROLE_PERMISSION";
    }

    /**
     * 状态常量
     * @author yyk
     */
    public static final class Status {
        /**
         * 下线
         */
        public final static Integer STATUS_0 = 0;
        /**
         * 上线
         */
        public final static Integer STATUS_1 = 1;
        /**
         * 已删除
         */
        public final static Integer DEL_FLAG_0 = 0;
        /**
         * 未删除
         */
        public final static Integer DEL_FLAG_1 = 1;

    }
}
